<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>后盾人</title>
  </head>
  <body></body>
  <script>
    let a = new Set([1, 2, 3, 4, 5]);
    let b = new Set([4, 5, 2, 9]);
    //并集
    // console.log(new Set([...a, ...b]));

    console.log(
      new Set(
        [...a].filter(function(item) {
          return b.has(item);
        })
      )
    );
  </script>
</html>
